package cn.iocoder.yudao.module.fengdong.smartelderly.utils;

import cn.hutool.core.util.IdcardUtil;

import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.TREATMENT_USER_NOT_EXISTS_IDENTITYCARD;

/**
 * @author zhangjiasong
 * @description: TODO
 * @date 2023/12/15 14:05
 */
public class IdentityCardUtils {
    public static IdcardUtil.Idcard verifyIdentityCard(String  card) {
        String idNum=card.toUpperCase();
        boolean validCard = IdcardUtil.isValidCard(idNum);
        if(!validCard) {
            throw exception(TREATMENT_USER_NOT_EXISTS_IDENTITYCARD);
        }
        return IdcardUtil.getIdcardInfo(idNum);
    }
}
